<%@page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.transcargo.data.CountriesData" %>
<%@ page import="com.transcargo.geo.Country" %>
<%@ page import="com.transcargo.geo.Region" %>
<%@ page import="com.transcargo.geo.City" %>
<%@ page import="java.util.Date" %>
<%@include file="header.jsf"%>
<%@include file="session.jsf"%>
<%@include file="resolve_country.jsf"%>
<%
	Date date = new Date();
	Country[] countries = CountriesData.getCountries(dbase);

%>
<html>
  	<head><title>TransCargo</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script type="text/javascript" src="ajaxrequest.js"></script>
	<script type="text/javascript" src="chooseareas.js"></script>
    <script type="text/javascript" src="forms.js"></script>
	<link type="text/css" href="transcargo.css" rel="stylesheet"/>

<script type="text/javascript">
var xslDoc = new Array();
var xslDocNames = new Array();
xslDocNames[0] = 'transform/route.xslt';
xslDocNames[1] = 'transform/empty.xslt';
if (window.DOMParser == null) {
  xslDoc[0]=new ActiveXObject("Microsoft.XMLDOM");
  xslDoc[0].async="false";
  xslDoc[1]=new ActiveXObject("Microsoft.XMLDOM");
  xslDoc[1].async="false";
}

var num_countries=<%=countries.length%>;
var Countries=new Array();
var CountryValues=new Array();
<%
	out.println("Countries[0]='*';");
	out.println("CountryValues[0]='0';");
    for (int i = 0; i < countries.length; i++) {
        Country country = countries[i];
        out.println("Countries[" + (i+1) + "]='" + country.getName() + "';");
        out.println("CountryValues[" + (i+1) + "]='" + country.getId() + "';");
    }
%>
var cid = <%=country_id%>;

</script>
  </head>
  <body>

    <table cellpadding="0" cellspacing="0" border="0" width="100%">
        <tr><td colspan="3">
			<%@include file="page_header.jsf"%>
        </td></tr>
        <tr><td width="80%" align="center">
            <table width="100%" cellpadding="0" cellspacing="0">
	            <tr><td align="center"><h1>ТрансКарго</h1></td></tr>
	            <tr><td align="center" valign="top"><center>Расчёт расстояний<br>
				<form name="sform" id="sform" action="#" onsubmit="submitDistance();return false;">
<table cellspacing="0" cellpadding="0" width="100%" border="0">
		<tr>
			<td valign="top">
				<table cellspacing="0" cellpadding="0" border="0">
					<tr>

						<td>
							<span>Начало маршрута</span>
						</td>
					</tr>
					<tr>
						<td>
							<div id="FromPlaceHolder"></div>
						</td>
					</tr>
					<tr>
						<td>
							<span>Конец маршрута</span>
						</td>
					</tr>

					<tr>
						<td><div id="ToPlaceHolder"></div>
						</td>
					</tr>
					<tr>
						<td>

							<br />
						</td>
					</tr>
					<tr>
						<td>
							<span>Промежуточные точки</span>
						</td>
					</tr>

					<tr>
						<td style="height: 30px">
						
						        <div id="City1PlaceHolder"></div><br>
						        <div id="City2PlaceHolder"></div><br>
						        <div id="City3PlaceHolder"></div><br>
						        <div id="City4PlaceHolder"></div><br>
						        <div id="City5PlaceHolder"></div><br>
						    
						</td>

					</tr>
				</table>
				

        
				<table cellspacing="0" cellpadding="0" border="0">
					<tr>
						<td>
							<br />
						</td>
					</tr>
					<tr>

						<td>
							<span searchName="Ferries"><input id="ctl00_ctl00_main_PlaceHolderMain_chkFerries" type="checkbox" name="ctl00$ctl00$main$PlaceHolderMain$chkFerries" /></span></td>
						<td>
							&nbsp;</td>
						<td>
							Разрешить паромы</td>
					</tr>
					<tr>

						<td>
							<span searchName="Zimnik"><input id="ctl00_ctl00_main_PlaceHolderMain_chkZimnik" type="checkbox" name="ctl00$ctl00$main$PlaceHolderMain$chkZimnik" /></span></td>
						<td>
							&nbsp;</td>
						<td>
							Разрешить "зимники"</td>
					</tr>
					<tr>

						<td colspan="3">
							<table height="100%" cellspacing="0" cellpadding="0" width="100%" border="0">
								<tr>
									<td>
										<table height="100%" cellspacing="0" cellpadding="0" width="100%" border="0">
											<tr>
												<td valign="middle">
													<input type=radio name=fastWay id=rbtnShort value="">
												</td>

												<td valign="middle">
													&nbsp;Самый "короткий" маршрут
												</td>
											</tr>
											<tr>
												<td>
													<input type=radio name=fastWay id=rbtnFast value="on" checked>
												</td>
												<td>

													&nbsp;Самый "быстрый" маршрут
												</td>
											</tr>
										</table>
									</td>
								</tr>
							</table>
						</td>
					</tr>

					<tr>
						<td><span searchName="LargeCities"><input id="ctl00_ctl00_main_PlaceHolderMain_chkLargeCities" type="checkbox" name="bigCities" onclick="return onOnlyLargeCities(this);" /></span></td>
						<td>&nbsp;</td>
						<td>Показывать только крупные пункты</td>
					</tr>
					<tr>
						<td>
							<span searchName="MapVisible"><input id="ctl00_ctl00_main_PlaceHolderMain_chkMapVisible" type="checkbox" name="ctl00$ctl00$main$PlaceHolderMain$chkMapVisible" checked="checked" /></span></td>

						<td>
							&nbsp;</td>
						<td>
							Показывать карту</td>
					</tr>					
				</table>

				<table width="120px" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td>
						<a href="javascript:submitDistance();">Рассчитать</a>								
								</td>
					</tr>

					<tr>
						<td>

							<a href="#" class="menu2" onclick="return onClear();">Очистить</a>
						</td>
					</tr>
				</table>
		</td></tr></table></center>
        </td>
		<td align="center"><div id="MsgArea"></div></td>
		<td valign="top"><%@include file="login.jsf"%><br><%@include file="quicksearch.jsf"%></td></tr>
    </table>
</td></tr></table>
<script type="text/javascript">
	var ef = document.getElementById('FromPlaceHolder');
	var et = document.getElementById('ToPlaceHolder');
	AddSearchArea('cityFrom',ef, 40);
	AddSearchArea('cityTo',et, 40);
	et = document.getElementById('City1PlaceHolder');
	AddSearchArea('city1',et, 40);
	et = document.getElementById('City2PlaceHolder');
	AddSearchArea('city2',et, 40);
	et = document.getElementById('City3PlaceHolder');
	AddSearchArea('city3',et, 40);
	et = document.getElementById('City4PlaceHolder');
	AddSearchArea('city4',et, 40);
	et = document.getElementById('City5PlaceHolder');
	AddSearchArea('city5',et, 40);
</script>

  </body>
</html>
